package com.kind.basketball.basketballappactivity.Activity;

/**
 * Created by Administrator on 2016/7/11.
 */
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.app.Activity;
import android.content.Context;

import com.kind.basketball.basketballappactivity.R;

public class MainActivity extends Activity {
    private Context context;
    private int []PhotosIntArray ;
    private LayoutInflater Inflater;
    private LinearLayout HSlinearLayout;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.discovery_activity);
        findView();
        initview();
    }

    private void findView(){
        context=this;
        Inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        HSlinearLayout=(LinearLayout) findViewById(R.id.galleryLinearLayout);

    }
    private void initview(){
        PhotosIntArray=new int[]{R.mipmap.guang_xxhdpi,R.mipmap.guang_xxhdpi,R.mipmap.guang_xxhdpi,R.mipmap.guang_xxhdpi};
        View itemView=null;
        ImageView imageView=null;
        for (int i = 0; i < PhotosIntArray.length; i++) {
            itemView=Inflater.inflate(R.layout.gallery_item, null);
            imageView=(ImageView) itemView.findViewById(R.id.imageView);
            imageView.setImageResource(PhotosIntArray[i]);
            HSlinearLayout.addView(itemView);
        }
    }

}


